<template>
  <div class="home-page">
    <van-tabs>
      <van-tab v-for="item in myChannels" :title="item.name" :key="item.id">
        <ArticleList/> {{ item.id }}
      </van-tab>
    </van-tabs>
    <!-- 按钮 -->
    <div class="btn-wrapper">
      <geek-icon name="search"></geek-icon>
      <geek-icon name="channel"></geek-icon>
    </div>
  </div>
</template>
<script>
import { getMyChannelsApi } from '@/api/channel'
import ArticleList from './components/article-list.vue'

export default {
  name: 'HomePage',
  components: {
    ArticleList
  },
  data () {
    return {
      myChannels: []
    }
  },
  async created () {
    const [, res] = await getMyChannelsApi()
    this.myChannels = res.data.data.channels
  }
}
</script>
<style scoped lang="less">

/deep/ .van-tabs {
  height: 100%;
  display: flex;
  flex-direction: column;

  .van-tabs__line {
    background: #FC6627;
    height: 3px;
    width: 25px;
  }

  .van-tab {
    color: #9EA1AE;
  }

  .van-tab--active {
    font-size: 18px;
    color: #333;
  }

  .van-tabs__wrap {
    padding-right: 86px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  }

  .van-tabs__content {
    flex: 1;
    overflow: hidden;
  }

  .van-tab__pane {
    height: 100%;
  }
}

.home-page {
  .btn-wrapper {
    width: 86px;
    height: 44px;
    background: transparent;
    position: absolute;
    right: 0;
    top: 0;
    display: flex;
    align-items: center;

    .geek-icon {
      flex: 1;
      text-align: center;
      font-size: 18px;
    }

    &::before {
      content: "";
      width: 20px;
      height: 44px;
      position: absolute;
      left: -20px;
      top: 0;
      background: linear-gradient(to right, rgba(255, 255, 255, 0), #fff);
    }
  }
}
</style>
